from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from ament_index_python.packages import get_package_share_directory
import os

def generate_launch_description():

    center_detection_node = Node(
        package='center_detection',
        executable='center_detector',
        name='center_detector',
        parameters=[
            PathJoinSubstitution([                    
                get_package_share_directory('center_detection'), 
                'config',
                'center_detector.params.yaml'
            ])   
        ],
        output='screen'
    )

    local_navigation_node = Node(
        package='local_navigation',
        executable='local_navigator',
        name='local_navigator',
        parameters=[
            PathJoinSubstitution([                    
                get_package_share_directory('local_navigation'), 
                'config',
                'local_navigator.params.yaml'
            ])   
        ],
        output='screen'
    )
    

    return LaunchDescription([
        center_detection_node,
        local_navigation_node
    ])
